<?php
namespace app\traits;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
trait JwtOpt{
    public function makeToken(){
        $key = getSalt();
        $payload = [
            'iss' => 'http://tp8vue3.test',
            'aud' => 'http://tp8vue3.test',
            'iat' => time(),
            'nbf' => time(),
            'exp' => time()+(int)config('app.token_expire'),
            'user_id' => $this->id
        ];
       return JWT::encode($payload, $key, 'HS256');
    }
}